<template>
  <div>
    <van-nav-bar
      style="background-color: Gainsboro;"
      title="消息通知"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="center" v-for="item in news" :key="item.id">
      <div class="main">
        <div class="title">
          <h1>{{ item.news_title }}</h1>
        </div>
       <p>
          <span>{{ item.news_date }}</span>
          <span>{{ item.news_time }}</span>
        </p>
      </div>
      <div class="content">{{ item.news_content }}</div>
    </div>
  </div>
</template>

<script>
  import httpApi from '@/http';
import { Toast } from 'vant';

  export default {
    data() {
      return {
        news: {}
      }
    },
    methods: {
      onClickLeft() {
        this.$router.push('/home/my')
      },

      getnews(){
        httpApi.movieApi.queryNews().then(res=>{
          this.news = res.data.data
          console.log('消息列表',this.news)
        })
      }
    },
    mounted () {
      this.getnews()
    },
  }
</script>

<style lang="scss" scoped>
.center{
  padding: 5px;
  .main{
    border-bottom: 2px solid #9a9a9a;
    
    .title{
      font-size: 15px;
      margin: 10px;
    }
    p{
      span{
        margin-left: 10px;
        color: #9a9a9a;
      }
    }
  }
  .content{
    margin: 10px;
  }
}
</style>